package com.wf.DouDiZhuOL.task;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorPool {
	private ExecutorService threadPool = null;
	
	public static ExecutorPool _instance = null;
	public static ExecutorPool getInstance() 
	{
		if(_instance == null) 
		{
			_instance = new ExecutorPool();
		}
		return _instance;
	}
	
	public void init() 
	{
		threadPool = Executors.newCachedThreadPool();
	}
	
	public void execute(Runnable runnable) 
	{
		threadPool.execute(runnable);
	}
	
	public void shutdown() 
	{
		if(!threadPool.isShutdown())
		{
			threadPool.shutdown();
		}
	}
}
